import { BuildOptions } from "vite"

const IS_PROD = process.env.NODE_ENV === 'production',
  sysArr: string[] = process.env.npm_package_name?.split('/') || []
export const build: BuildOptions = {
  sourcemap: !IS_PROD,
  outDir: `../../dist/${sysArr[1] || sysArr[0] || '未定义'}`,
  emptyOutDir: true,
  rollupOptions: {
    output: {
      manualChunks: {
        vue: ['@vue/shared', '@vue/runtime-core', '@vue/runtime-dom', '@vue/reactivity'],
        pinia: ['pinia'],
        router: ['vue-router'],
        elementPlus: ['element-plus']
      }
    }
  }
}